#include<stdio.h>

//统计一串字符串中a的个数

int counter(const char* str)
{
    int count = 0;
    while (*str != '\0')
    {
        if(*str == 'a')
        {
            count++;
        }
        str++;
    }
    return count;
}

int main()
{
    const char* count_a = "banana and apple";
    int result = counter(count_a);
    printf("%d \n",result);
    return 0;
}